<?php
$this->render('include/sortLink.phtml');
echo $this->render('community/member/_tab.phtml');
$this->headScript()->appendFile(_STATIC_HTTP . '/jquery/checkAll.js');
$lang = new system_setting_language();
if(!function_exists('__sortLink')) {
	function __sortLink() {}
}
function _gender($g) {
	if($g == 1) return 'Male';
	if($g == 2) return 'Remale';
	return '-';
}
?>
<form action="" method="post">
<div class="body">
	<table class="list">
		<tr>
			<th class="narrow center">A</th>
			<th class="narrow sort"><?php echo __sortLink('id', '#');?></th>
			<th class="sort"><?php echo __sortLink('identity', 'IDENTITY');?></th>
			<th class="sort"><?php echo __sortLink('email', 'EMAIL');?></th>
			<th class="narrow sort"><?php echo __sortLink('gender', 'GENDER');?></th>
			<th><?php echo $this->language('NICKNAME');?></th>
			<th><?php echo $this->language('LAST IP');?></th>
			<th class="time sort"><?php echo __sortLink('creationtime', 'CREATION TIME');?></th>
			<th class="time sort"><?php echo __sortLink('lastupdate', 'LAST LOGIN');?></th>
			<th class="narrow center"><?php echo '<input type="checkbox" name="select-all" id="select-all" value="1" rel="id[]" />';?></th>
		</tr>
		<?php foreach($this->list AS $row) { ?>
		<tr>
			<td class="center"><img src="<?php echo $row->getAvatar()->getSmall(false);?>" style="width:16px;height:16px;border:0;" /></td>
			<td class="center"><?php echo $row->getId();?></td>
			<td><a href="<?php echo $this->url('community/member/edit', array('id' => $row->getId()));?>"><?php echo $row->getIdentity();?></a></td>
			<td><?php echo $row->getEmail();?></td>
			<td><?php echo $this->language(_gender($row->getGender()));?></td>
			<td><?php echo $row->getNickname();?></td>
			<td><?php echo $row->getLastupip();?></td>
			<td class="time"><?php echo $this->date($row->getCreationdate());?></td>
			<td class="time"><?php echo $this->date($row->getLastupdate());?></td>
			<td class="center"><?php
				if(in_array($row->getId(), $this->checkedList)) {
					$checked = array('checked' => 'checked');
				} else {
					$checked = array();
				}
				echo $this->form()->checkbox('id[]', $row->getId(), array_merge(array('id' => 'id-' . $row->getId()), $checked));
			?></td>
		</tr>
		<?php } ?>
		<?php if(count($this->list) <= 0) {?>
		<tr>
			<td colspan="10" class="nohover">
				<div class="msg">
					<div class="common error" style="border:0;background:#fff;">
						<i class="icon"></i>
						<h4>STOP</h4>
						<div class="msg-bd">
							No User found. 
						</div>
					</div>
				</div>
			</td>
		</tr>
		<?php } ?>
	</table>
</div>
<div class="body">
	<div style="float:right;margin-bottom:5px;">
		<?php //echo $this->render('include/deleteButton.phtml');?>
	</div>
	<?php echo $this->paginator($this->list)->render();?>
</div>
</form>
